<script setup>
import {onMounted, ref} from "vue"
import axios from "axios";
import {ElMessage} from "element-plus";


const CommentList =ref([]);
const CourseList =ref([]);

const user =ref(getUser());

const LoadCommentList = () =>{
  axios.get(BASE_URL+"/api/comment/list/user/"+user.value.userId).then((response)=>{
    if (response.data.code == 2000) {
      CommentList.value = response.data.data;
      console.log(CommentList.value);
    }else
      ElMessage.error(response.data.msg)

  })
}

// const LoadCourseList = () =>{
//
//
//   axios.get(BASE_URL+"/v1/course/select").then((response)=>{
//     if (response.data.code == 2000) {
//       CourseList.value = response.data.data;
//       console.log(CourseList.value);
//     }else
//       ElMessage.error(response.data.msg)
//
//   })
// }

onMounted(()=>{
  LoadCommentList();
  // LoadCourseList();
})

</script>

<template>
  <div class="flex flex-wrap gap-4">
<!--    <el-card style="width: 100%" shadow="always">Always</el-card>-->
<!--    <el-card style="width: 100%" shadow="hover">Hover</el-card>-->
<!--    <el-card style="width: 100%" shadow="never">Never</el-card>-->
    <el-card style="width: 100%" shadow="hover" v-for="item in CommentList">{{user.username}}:{{item.content}}</el-card>
  </div>
</template>

<style scoped>

</style>